package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.BatchBadpheno;
import com.indusfo.spc.service.BatchBadphenoService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author liub
 * @Date 2019/11/25 14:48
 * @Version 1.0
 */

@Controller
@RequestMapping(value = "/service/batchBadpheno")
public class BatchBadphenoController {

    @Autowired
    private BatchBadphenoService batchBadphenoService;

    /**
     * 查询
     */
    @RequestMapping(value = "/queryBatchBadpheno")
    @ResponseBody
    public JSONObject queryBatchBadpheno(BatchBadpheno batchBadpheno) {
        JSONObject json = batchBadphenoService.queryBatchBadpheno(batchBadpheno);
        return json;
    }

    /**
     * 新增
     */
    @RequestMapping(value = "/insertBatchBadpheno", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject insertBatchBadpheno(BatchBadpheno batchBadpheno) {
        JSONObject json = batchBadphenoService.insertBatchBadpheno(batchBadpheno);
        return json;
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/updateBatchBadpheno", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject updateBatchBadpheno(BatchBadpheno batchBadpheno) {
        JSONObject json = batchBadphenoService.updateBatchBadpheno(batchBadpheno);
        return json;
    }

    /**
     * 删除
     */
    @RequestMapping(value = "/deleteBatchBadpheno", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject deleteBatchBadpheno(@RequestParam("batchBadphenoIds") List<Integer> batchBadphenoIds, Integer dataState) {
        dataState = 2;
        JSONObject json = batchBadphenoService.deleteBatchBadpheno(batchBadphenoIds, dataState);
        return json;
    }

    /**
     * 启停
     */
    @RequestMapping(value = "/definedBatchBadpheno", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject definedBatchBadpheno(@RequestParam("batchBadphenoIds") List<Integer> batchBadphenoIds, Integer dataState) {
        JSONObject json = batchBadphenoService.deleteBatchBadpheno(batchBadphenoIds, dataState);
        return json;
    }
}
